From a12905e091527e8d874251953f8759509ff88270 Mon Sep 17 00:00:00 2001 From: Andreas Tille Date: Fri, 8 Jan 2021 10:47:39 +0100 Subject: [PATCH] Import fermi-lite_0.1+git20190320.b499514-1.debian.tar.xz [dgit import tarball fermi-lite 0.1+git20190320.b499514-1 fermi-lite_0.1+git20190320.b499514-1.debian.tar.xz] --- TODO | 2 + changelog | 123 +++++++++ clean | 1 + control | 58 +++++ copyright | 71 +++++ install | 1 + libfml0.symbols | 194 ++++++++++++++ manpages | 1 + patches/bcf_seqlib.patch | 346 +++++++++++++++++++++++++ patches/ensure-signed-comparison.patch | 22 ++ patches/gcc10.patch | 16 ++ patches/hardening | 43 +++ patches/make_shared_lib | 40 +++ patches/rename_bseq1_t.patch | 260 +++++++++++++++++++ patches/series | 8 + patches/simde | 14 + patches/sync_instead_of_atomic | 23 ++ rules | 43 +++ salsa-ci.yml | 4 + source/format | 1 + tests/asm | 8 + tests/build-lib | 19 ++ tests/control | 7 + upstream/metadata | 13 + watch | 7 + 25 files changed, 1325 insertions(+) create mode 100644 TODO create mode 100644 changelog create mode 100644 clean create mode 100644 control create mode 100644 copyright create mode 100644 install create mode 100644 libfml0.symbols create mode 100644 manpages create mode 100644 patches/bcf_seqlib.patch create mode 100644 patches/ensure-signed-comparison.patch create mode 100644 patches/gcc10.patch create mode 100644 patches/hardening create mode 100644 patches/make_shared_lib create mode 100644 patches/rename_bseq1_t.patch create mode 100644 patches/series create mode 100644 patches/simde create mode 100644 patches/sync_instead_of_atomic create mode 100755 rules create mode 100644 salsa-ci.yml create mode 100644 source/format create mode 100755 tests/asm create mode 100755 tests/build-lib create mode 100644 tests/control create mode 100644 upstream/metadata create mode 100644 watch diff --git a/TODO b/TODO new file mode 100644 index 0000000..ec38be1 --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +- Add correct autopkgtests (still cloned from minimap) +- Add man page diff --git a/changelog b/changelog new file mode 100644 index 0000000..758e510 --- /dev/null +++ b/changelog @@ -0,0 +1,123 @@ +fermi-lite (0.1+git20190320.b499514-1) unstable; urgency=medium + + [ Michael R. Crusoe ] + * Team upload. + * Switch to upstream HEAD using gitmode in watch file + * Remove trailing whitespace in debian/changelog (routine-update) + * Use the libsimde-dev package instead of our code copy + + [ Andreas Tille ] + * Standards-Version: 4.5.1 (routine-update) + * debhelper-compat 13 (routine-update) + + -- Andreas Tille Fri, 08 Jan 2021 10:47:39 +0100 + +fermi-lite (0.1-13) unstable; urgency=medium + + * Fix package to build with gcc-10 (Closes: #957198) + + -- Nilesh Patra Sat, 18 Apr 2020 22:59:03 +0530 + +fermi-lite (0.1-12) unstable; urgency=medium + + * Team upload. + * debian/patches/sync_instead_of_atomic: fix logic and re-enable (fetch the + previous value, not the new one). Fixes build on mipsel. + * Added a basic package time test & autopkgtest to confirm the patch using + fml-asm + + -- Michael R. Crusoe Mon, 30 Mar 2020 10:55:37 +0200 + +fermi-lite (0.1-11) unstable; urgency=medium + + [ Steve Langasek ] + * Ensure that our variable checking for >= 0 is signed + Closes: #954127 + + -- Andreas Tille Sat, 28 Mar 2020 19:33:46 +0100 + +fermi-lite (0.1-10) unstable; urgency=medium + + * Team upload. + * Revert change: Fix compatibility on mipsel, m68k, powerpc, and sh4 by using + __sync instead of __atomic from 0.1-8 since it breaks ariba + * Add salsa-ci file (routine-update) + * Rules-Requires-Root: no (routine-update) + * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, + Repository-Browse. + + -- Andreas Tille Thu, 12 Mar 2020 14:23:57 +0100 + +fermi-lite (0.1-9) unstable; urgency=medium + + * Team upload. + * Mark libfml{0,-dev} as Multi-Arch: same + * Add armel to the -latomic group + + -- Michael R. Crusoe Sat, 15 Feb 2020 13:58:17 +0100 + +fermi-lite (0.1-8) unstable; urgency=medium + + * Team upload. + * Fix compatibility on mipsel, m68k, powerpc, and sh4 by using __sync instead + of __atomic + * Standards-Version: 4.5.0 (routine-update) + * debhelper-compat 12 (routine-update) + + -- Michael R. Crusoe Sat, 15 Feb 2020 13:18:41 +0100 + +fermi-lite (0.1-7) unstable; urgency=medium + + * Team upload. + * Add -latomic for those archs that need it + + -- Michael R. Crusoe Sat, 14 Dec 2019 15:33:59 +0100 + +fermi-lite (0.1-6) unstable; urgency=medium + + * Team upload. + * Enable for all architectures using simde + * Ship a symbols file + + -- Michael R. Crusoe Fri, 13 Dec 2019 18:04:33 +0100 + +fermi-lite (0.1-5) unstable; urgency=medium + + [ Steffen Möller ] + * Add new d/u/metadata file + + [ Sascha Steinbiss ] + * Update Vcs-* fields with Salsa addresses. + * Bump Standards-Version. + * Remove unnecessary Testsuite field. + * Use debhelper 11. + * Improve hardening. + + -- Sascha Steinbiss Wed, 04 Jul 2018 23:40:50 +0200 + +fermi-lite (0.1-4) unstable; urgency=medium + + * Upload to unstable + + -- Andreas Tille Sun, 18 Jun 2017 08:12:35 +0200 + +fermi-lite (0.1-3) experimental; urgency=medium + + * Team upload. + * Avoid name space conflict with bwa + + -- Andreas Tille Thu, 02 Feb 2017 10:59:28 +0100 + +fermi-lite (0.1-2) unstable; urgency=medium + + * Autopkgtest: build example outside of upstream source tree. + * Restrict architectures to those with SSE2 support. + See also upstream's comment at https://github.com/lh3/fermi-lite/issues/4 + + -- Sascha Steinbiss Thu, 04 Aug 2016 05:37:30 +0000 + +fermi-lite (0.1-1) unstable; urgency=low + + * Initial packaging (Closes: #832757) + + -- Sascha Steinbiss Thu, 28 Jul 2016 22:26:11 +0000 diff --git a/clean b/clean new file mode 100644 index 0000000..91fae9f --- /dev/null +++ b/clean @@ -0,0 +1 @@ +libfml.so.0 diff --git a/control b/control new file mode 100644 index 0000000..8a76c52 --- /dev/null +++ b/control @@ -0,0 +1,58 @@ +Source: fermi-lite +Maintainer: Debian Med Packaging Team +Uploaders: Sascha Steinbiss , Nilesh Patra +Section: science +Priority: optional +Build-Depends: debhelper-compat (= 13), + d-shlibs, + zlib1g-dev, + libsimde-dev, + help2man +Standards-Version: 4.5.1 +Vcs-Browser: https://salsa.debian.org/med-team/fermi-lite +Vcs-Git: https://salsa.debian.org/med-team/fermi-lite.git +Homepage: https://github.com/lh3/fermi-lite +Rules-Requires-Root: no + +Package: fml-asm +Architecture: any +Depends: ${misc:Depends}, + ${shlibs:Depends}, + zlib1g +Description: tool for assembling Illumina short reads in small regions + Fml-asm is a command-line tool for assembling Illumina short reads in regions + from 100bp to 10 million bp in size, based on the fermi-lite library. + It is largely a light-weight in-memory version of fermikit without + generating any intermediate files. It inherits the performance, the relatively + small memory footprint and the features of fermikit. In particular, fermi-lite + is able to retain heterozygous events and thus can be used to assemble diploid + regions for the purpose of variant calling. + +Package: libfml0 +Section: libs +Architecture: any +Multi-Arch: same +Depends: ${shlibs:Depends}, + ${misc:Depends}, + zlib1g +Description: library for assembling Illumina short reads in small regions + Fermi-lite is a standalone C library tool for assembling Illumina short + reads in regions from 100bp to 10 million bp in size. + . + This package contains a shared library offering the fermi-lite API to custom C + programs. + +Package: libfml-dev +Section: libdevel +Architecture: any +Multi-Arch: same +Depends: ${misc:Depends}, + libfml0 (= ${binary:Version}), + zlib1g-dev, + ${devlibs:Depends} +Description: development headers for libfml + Fermi-lite is a standalone C library tool for assembling Illumina short + reads in regions from 100bp to 10 million bp in size. + . + This package contains the C library headers for using libfml in custom tools, + along with a static library. diff --git a/copyright b/copyright new file mode 100644 index 0000000..0452df0 --- /dev/null +++ b/copyright @@ -0,0 +1,71 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: fermi-lite +Source: https://github.com/lh3/fermi-lite +Upstream-Contact: Heng Li + +Files: * +Copyright: © 2016 Broad Institute +License: MIT + +Files: khash.h kseq.h +Copyright: (c) 2008, 2009, 2011 Attractive Chaos +License: MIT + +Files: ksort.h +Copyright: (c) 2008, 2011 Attractive Chaos +License: MIT + +Files: kstring.h +Copyright: (c) Attractive Chaos +License: MIT + +Files: ksw.h +Copyright: (c) 2011 Attractive Chaos +License: MIT + +Files: kvec.h +Copyright: (c) 2008 Attractive Chaos +License: MIT + +Files: debian/* +Copyright: © 2016 Debian Med Packaging Team +License: GPL-3+ + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +License: GPL-3+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + diff --git a/install b/install new file mode 100644 index 0000000..4cdf840 --- /dev/null +++ b/install @@ -0,0 +1 @@ +fml-asm /usr/bin diff --git a/libfml0.symbols b/libfml0.symbols new file mode 100644 index 0000000..47cb7c2 --- /dev/null +++ b/libfml0.symbols @@ -0,0 +1,194 @@ +libfml.so.0 libfml0 #MINVER# +* Build-Depends-Package: libfml-dev + bfc_ch_count@Base 0.1 + bfc_ch_destroy@Base 0.1 + bfc_ch_get@Base 0.1 + bfc_ch_get_k@Base 0.1 + bfc_ch_hist@Base 0.1 + bfc_ch_init@Base 0.1 + bfc_ch_insert@Base 0.1 + bfc_ch_kmer_occ@Base 0.1 + bfc_ec1@Base 0.1 + bfc_ec_best_island@Base 0.1 + bfc_ec_first_kmer@Base 0.1 + bfc_ec_greedy_k@Base 0.1 + bfc_ec_kcov@Base 0.1 + bfc_kmer_null@Base 0.1 + bfc_opt_init@Base 0.1 + fm6_get_nei@Base 0.1 + fm6_is_contained@Base 0.1 + fm6_retrieve@Base 0.1 + fml_assemble@Base 0.1 + fml_correct@Base 0.1 + fml_correct_core@Base 0.1 + fml_count@Base 0.1 + fml_fltuniq@Base 0.1 + fml_fmi2mag@Base 0.1 + fml_fmi2mag_core@Base 0.1 + fml_fmi_destroy@Base 0.1 + fml_fmi_gen@Base 0.1 + fml_mag2utg@Base 0.1 + fml_mag_clean@Base 0.1 + fml_mag_destroy@Base 0.1 + fml_opt_adjust@Base 0.1 + fml_opt_init@Base 0.1 + fml_seq2fmi@Base 0.1 + fml_seq_read@Base 0.1 + fml_utg_destroy@Base 0.1 + fml_utg_print@Base 0.1 + g_defr@Base 0.1 + g_trinull@Base 0.1 + kh_clear_64@Base 0.1 + kh_del_64@Base 0.1 + kh_destroy_64@Base 0.1 + kh_get_64@Base 0.1 + kh_init_64@Base 0.1 + kh_put_64@Base 0.1 + kh_resize_64@Base 0.1 + kmer_correct@Base 0.1 + ks_combsort_128x@Base 0.1 + ks_combsort_128y@Base 0.1 + ks_combsort_ec@Base 0.1 + ks_combsort_infocmp@Base 0.1 + ks_combsort_uint64_t@Base 0.1 + ks_combsort_vlt1@Base 0.1 + ks_combsort_vlt2@Base 0.1 + ks_heapdown_128x@Base 0.1 + ks_heapdown_128y@Base 0.1 + ks_heapdown_ec@Base 0.1 + ks_heapdown_infocmp@Base 0.1 + ks_heapdown_uint64_t@Base 0.1 + ks_heapdown_vlt1@Base 0.1 + ks_heapdown_vlt2@Base 0.1 + ks_heapmake_128x@Base 0.1 + ks_heapmake_128y@Base 0.1 + ks_heapmake_ec@Base 0.1 + ks_heapmake_infocmp@Base 0.1 + ks_heapmake_uint64_t@Base 0.1 + ks_heapmake_vlt1@Base 0.1 + ks_heapmake_vlt2@Base 0.1 + ks_heapsort_128x@Base 0.1 + ks_heapsort_128y@Base 0.1 + ks_heapsort_ec@Base 0.1 + ks_heapsort_infocmp@Base 0.1 + ks_heapsort_uint64_t@Base 0.1 + ks_heapsort_vlt1@Base 0.1 + ks_heapsort_vlt2@Base 0.1 + ks_heapup_128x@Base 0.1 + ks_heapup_128y@Base 0.1 + ks_heapup_ec@Base 0.1 + ks_heapup_infocmp@Base 0.1 + ks_heapup_uint64_t@Base 0.1 + ks_heapup_vlt1@Base 0.1 + ks_heapup_vlt2@Base 0.1 + ks_introsort_128x@Base 0.1 + ks_introsort_128y@Base 0.1 + ks_introsort_ec@Base 0.1 + ks_introsort_infocmp@Base 0.1 + ks_introsort_uint64_t@Base 0.1 + ks_introsort_vlt1@Base 0.1 + ks_introsort_vlt2@Base 0.1 + ks_ksmall_128x@Base 0.1 + ks_ksmall_128y@Base 0.1 + ks_ksmall_ec@Base 0.1 + ks_ksmall_infocmp@Base 0.1 + ks_ksmall_uint64_t@Base 0.1 + ks_ksmall_vlt1@Base 0.1 + ks_ksmall_vlt2@Base 0.1 + ks_mergesort_128x@Base 0.1 + ks_mergesort_128y@Base 0.1 + ks_mergesort_ec@Base 0.1 + ks_mergesort_infocmp@Base 0.1 + ks_mergesort_uint64_t@Base 0.1 + ks_mergesort_vlt1@Base 0.1 + ks_mergesort_vlt2@Base 0.1 + ks_sample_128x@Base 0.1 + ks_sample_128y@Base 0.1 + ks_sample_ec@Base 0.1 + ks_sample_infocmp@Base 0.1 + ks_sample_uint64_t@Base 0.1 + ks_sample_vlt1@Base 0.1 + ks_sample_vlt2@Base 0.1 + ks_shuffle_128x@Base 0.1 + ks_shuffle_128y@Base 0.1 + ks_shuffle_ec@Base 0.1 + ks_shuffle_infocmp@Base 0.1 + ks_shuffle_uint64_t@Base 0.1 + ks_shuffle_vlt1@Base 0.1 + ks_shuffle_vlt2@Base 0.1 + ksw_align@Base 0.1 + ksw_i16@Base 0.1 + ksw_qinit@Base 0.1 + ksw_u8@Base 0.1 + kt_for@Base 0.1 + mag_b_destroyaux@Base 0.1 + mag_b_initaux@Base 0.1 + mag_cal_rdist@Base 0.1 + mag_eh_add@Base 0.1 + mag_eh_markdel@Base 0.1 + mag_g_amend@Base 0.1 + mag_g_build_hash@Base 0.1 + mag_g_clean@Base 0.1 + mag_g_destroy@Base 0.1 + mag_g_merge@Base 0.1 + mag_g_pop_open@Base 0.1 + mag_g_pop_simple@Base 0.1 + mag_g_print@Base 0.1 + mag_g_rm_edge@Base 0.1 + mag_g_rm_vext@Base 0.1 + mag_g_rm_vint@Base 0.1 + mag_g_simplify_bubble@Base 0.1 + mag_g_trim_open@Base 0.1 + mag_init_opt@Base 0.1 + mag_tid2idd@Base 0.1 + mag_v128_clean@Base 0.1 + mag_v_copy_to_empty@Base 0.1 + mag_v_del@Base 0.1 + mag_v_destroy@Base 0.1 + mag_v_flip@Base 0.1 + mag_v_pop_open@Base 0.1 + mag_v_transdel@Base 0.1 + mag_v_trim_open@Base 0.1 + mag_v_write@Base 0.1 + mag_vh_merge_try@Base 0.1 + mag_vh_pop_simple@Base 0.1 + mag_vh_simplify_bubble@Base 0.1 + mr_destroy@Base 0.1 + mr_init@Base 0.1 + mr_insert1@Base 0.1 + mr_insert_multi@Base 0.1 + mr_itr_first@Base 0.1 + mr_itr_next_block@Base 0.1 + mr_rank2a@Base 0.1 + mr_thr_min@Base 0.1 + rld_destroy@Base 0.1 + rld_dump@Base 0.1 + rld_enc@Base 0.1 + rld_enc_finish@Base 0.1 + rld_extend0@Base 0.1 + rld_extend@Base 0.1 + rld_init@Base 0.1 + rld_itr_init@Base 0.1 + rld_rank11@Base 0.1 + rld_rank1a@Base 0.1 + rld_rank21@Base 0.1 + rld_rank2a@Base 0.1 + rld_rank_index@Base 0.1 + rld_restore@Base 0.1 + rld_restore_mmap@Base 0.1 + rle_auxtab@Base 0.1 + rle_count@Base 0.1 + rle_insert@Base 0.1 + rle_insert_cached@Base 0.1 + rle_print@Base 0.1 + rle_rank2a@Base 0.1 + rle_split@Base 0.1 + rope_destroy@Base 0.1 + rope_init@Base 0.1 + rope_insert_run@Base 0.1 + rope_itr_first@Base 0.1 + rope_itr_next_block@Base 0.1 + rope_rank2a@Base 0.1 + seq_nt6_table@Base 0.1 + seq_revcomp6@Base 0.1 + seq_reverse@Base 0.1 diff --git a/manpages b/manpages new file mode 100644 index 0000000..f7e585b --- /dev/null +++ b/manpages @@ -0,0 +1 @@ +*.1 diff --git a/patches/bcf_seqlib.patch b/patches/bcf_seqlib.patch new file mode 100644 index 0000000..1035478 --- /dev/null +++ b/patches/bcf_seqlib.patch @@ -0,0 +1,346 @@ +Description: Try to take over patches from libSeqLib which needs separate bfc.h + FIXME: Please check the FIXME at the end. I think I did things wrong to put a + static declaration into header file but I had no better idea to make + ec1buf_init known in libSeqLib +Author: Andreas Tille +Last-Update: Thu, 02 Feb 2017 10:57:56 +0100 + +--- a/bfc.c ++++ b/bfc.c +@@ -7,24 +7,12 @@ + #include "kmer.h" + #include "internal.h" + #include "fml.h" ++#include "bfc.h" + + /******************* + *** BFC options *** + *******************/ + +-typedef struct { +- int n_threads, q, k, l_pre; +- int min_cov; // a k-mer is considered solid if the count is no less than this +- +- int max_end_ext; +- int win_multi_ec; +- float min_trim_frac; +- +- // these ec options cannot be changed on the command line +- int w_ec, w_ec_high, w_absent, w_absent_high; +- int max_path_diff, max_heap; +-} bfc_opt_t; +- + void bfc_opt_init(bfc_opt_t *opt) + { + memset(opt, 0, sizeof(bfc_opt_t)); +@@ -46,26 +34,6 @@ void bfc_opt_init(bfc_opt_t *opt) + opt->max_heap = 100; + } + +-/********************** +- *** K-mer counting *** +- **********************/ +- +-#define CNT_BUF_SIZE 256 +- +-typedef struct { // cache to reduce locking +- uint64_t y[2]; +- int is_high; +-} insbuf_t; +- +-typedef struct { +- int k, q; +- int n_seqs; +- const fml_seq1_t *seqs; +- bfc_ch_t *ch; +- int *n_buf; +- insbuf_t **buf; +-} cnt_step_t; +- + bfc_kmer_t bfc_kmer_null = {{0,0,0,0}}; + + static int bfc_kmer_bufclear(cnt_step_t *cs, int forced, int tid) +@@ -127,34 +95,6 @@ struct bfc_ch_s *fml_count(int n, const + return cs.ch; + } + +-/*************** +- *** Correct *** +- ***************/ +- +-#define BFC_MAX_KMER 63 +-#define BFC_MAX_BF_SHIFT 37 +- +-#define BFC_MAX_PATHS 4 +-#define BFC_EC_HIST 5 +-#define BFC_EC_HIST_HIGH 2 +- +-#define BFC_EC_MIN_COV_COEF .1 +- +-/************************** +- * Sequence struct for ec * +- **************************/ +- +-#include "kvec.h" +- +-typedef struct { // NOTE: unaligned memory +- uint8_t b:3, q:1, ob:3, oq:1; +- uint8_t dummy; +- uint16_t lcov:6, hcov:6, solid_end:1, high_end:1, ec:1, absent:1; +- int i; +-} ecbase_t; +- +-typedef kvec_t(ecbase_t) ecseq_t; +- + static int bfc_seq_conv(const char *s, const char *q, int qthres, ecseq_t *seq) + { + int i, l; +@@ -264,53 +204,6 @@ uint64_t bfc_ec_best_island(int k, const + return max > 0? (uint64_t)(max_i - max - k + 1) << 32 | max_i : 0; + } + +-/******************** +- * Correct one read * +- ********************/ +- +-#include "ksort.h" +- +-#define ECCODE_MISC 1 +-#define ECCODE_MANY_N 2 +-#define ECCODE_NO_SOLID 3 +-#define ECCODE_UNCORR_N 4 +-#define ECCODE_MANY_FAIL 5 +- +-typedef struct { +- uint32_t ec_code:3, brute:1, n_ec:14, n_ec_high:14; +- uint32_t n_absent:24, max_heap:8; +-} ecstat_t; +- +-typedef struct { +- uint8_t ec:1, ec_high:1, absent:1, absent_high:1, b:4; +-} bfc_penalty_t; +- +-typedef struct { +- int tot_pen; +- int i; // base position +- int k; // position in the stack +- int32_t ecpos_high[BFC_EC_HIST_HIGH]; +- int32_t ecpos[BFC_EC_HIST]; +- bfc_kmer_t x; +-} echeap1_t; +- +-typedef struct { +- int parent, i, tot_pen; +- uint8_t b; +- bfc_penalty_t pen; +- uint16_t cnt; +-} ecstack1_t; +- +-typedef struct { +- const bfc_opt_t *opt; +- const bfc_ch_t *ch; +- kvec_t(echeap1_t) heap; +- kvec_t(ecstack1_t) stack; +- ecseq_t seq, tmp, ec[2]; +- int mode; +- ecstat_t ori_st; +-} bfc_ec1buf_t; +- + #define heap_lt(a, b) ((a).tot_pen > (b).tot_pen) + KSORT_INIT(ec, echeap1_t, heap_lt) + +@@ -567,19 +460,6 @@ ecstat_t bfc_ec1(bfc_ec1buf_t *e, char * + return s; + } + +-/******************** +- * Error correction * +- ********************/ +- +-typedef struct { +- const bfc_opt_t *opt; +- const bfc_ch_t *ch; +- bfc_ec1buf_t **e; +- int64_t n_processed; +- int n_seqs, flt_uniq; +- fml_seq1_t *seqs; +-} ec_step_t; +- + static uint64_t max_streak(int k, const bfc_ch_t *ch, const fml_seq1_t *s) + { + int i, l; +@@ -663,6 +543,18 @@ float fml_correct_core(const fml_opt_t * + return kcov; + } + ++// Added by jwala for use in libSeqLib ++void kmer_correct(ec_step_t * es, int mode, bfc_ch_t * ch) { ++ int i = 0; ++ es->e = (bfc_ec1buf_t**)calloc(es->opt->n_threads, sizeof(void*)); //jwala added cast ++ for (i = 0; i < es->opt->n_threads; ++i) ++ es->e[i] = ec1buf_init(es->opt, ch), es->e[i]->mode = mode; ++ kt_for(es->opt->n_threads, worker_ec, es, es->n_seqs); ++ for (i = 0; i < es->opt->n_threads; ++i) ++ ec1buf_destroy(es->e[i]); ++ free(es->e); ++} ++ + float fml_correct(const fml_opt_t *opt, int n, fml_seq1_t *seq) + { + return fml_correct_core(opt, 0, n, seq); +--- /dev/null ++++ b/bfc.h +@@ -0,0 +1,153 @@ ++#ifndef AC_BFC_H__ ++#define AC_BFC_H__ ++ ++#include ++#include ++#include ++#include ++#include ++#include "htab.h" ++/* #include "kmer.h" ... this is actually included by htab.h */ ++#include "internal.h" ++#include "fml.h" ++#include "khash.h" ++ ++/* Andreas Tille : Its not clear where jwala took this from and what its purpose might be - commenting out for the moment ++#define _cnt_eq(a, b) ((a)>>14 == (b)>>14) ++#define _cnt_hash(a) ((a)>>14) ++KHASH_INIT(cnt, uint64_t, char, 0, _cnt_hash, _cnt_eq) ++typedef khash_t(cnt) cnthash_t; ++ ++struct bfc_ch_s { ++ int k; ++ cnthash_t **h; ++ // private ++ int l_pre; ++}; ++*/ ++ ++typedef struct { ++ int n_threads, q, k, l_pre; ++ int min_cov; // a k-mer is considered solid if the count is no less than this ++ ++ int max_end_ext; ++ int win_multi_ec; ++ float min_trim_frac; ++ ++ // these ec options cannot be changed on the command line ++ int w_ec, w_ec_high, w_absent, w_absent_high; ++ int max_path_diff, max_heap; ++} bfc_opt_t; ++ ++/********************** ++ *** K-mer counting *** ++ **********************/ ++ ++#define CNT_BUF_SIZE 256 ++ ++typedef struct { // cache to reduce locking ++ uint64_t y[2]; ++ int is_high; ++} insbuf_t; ++ ++typedef struct { ++ int k, q; ++ int n_seqs; ++ const fml_seq1_t *seqs; ++ bfc_ch_t *ch; ++ int *n_buf; ++ insbuf_t **buf; ++} cnt_step_t; ++ ++/*************** ++ *** Correct *** ++ ***************/ ++ ++#define BFC_MAX_KMER 63 ++#define BFC_MAX_BF_SHIFT 37 ++ ++#define BFC_MAX_PATHS 4 ++#define BFC_EC_HIST 5 ++#define BFC_EC_HIST_HIGH 2 ++ ++#define BFC_EC_MIN_COV_COEF .1 ++ ++/************************** ++ * Sequence struct for ec * ++ **************************/ ++ ++#include "kvec.h" ++ ++typedef struct { // NOTE: unaligned memory ++ uint8_t b:3, q:1, ob:3, oq:1; ++ uint8_t dummy; ++ uint16_t lcov:6, hcov:6, solid_end:1, high_end:1, ec:1, absent:1; ++ int i; ++} ecbase_t; ++ ++typedef kvec_t(ecbase_t) ecseq_t; ++ ++/******************** ++ * Correct one read * ++ ********************/ ++ ++#include "ksort.h" ++ ++#define ECCODE_MISC 1 ++#define ECCODE_MANY_N 2 ++#define ECCODE_NO_SOLID 3 ++#define ECCODE_UNCORR_N 4 ++#define ECCODE_MANY_FAIL 5 ++ ++typedef struct { ++ uint32_t ec_code:3, brute:1, n_ec:14, n_ec_high:14; ++ uint32_t n_absent:24, max_heap:8; ++} ecstat_t; ++ ++typedef struct { ++ uint8_t ec:1, ec_high:1, absent:1, absent_high:1, b:4; ++} bfc_penalty_t; ++ ++typedef struct { ++ int tot_pen; ++ int i; // base position ++ int k; // position in the stack ++ int32_t ecpos_high[BFC_EC_HIST_HIGH]; ++ int32_t ecpos[BFC_EC_HIST]; ++ bfc_kmer_t x; ++} echeap1_t; ++ ++typedef struct { ++ int parent, i, tot_pen; ++ uint8_t b; ++ bfc_penalty_t pen; ++ uint16_t cnt; ++} ecstack1_t; ++ ++typedef struct { ++ const bfc_opt_t *opt; ++ const bfc_ch_t *ch; ++ kvec_t(echeap1_t) heap; ++ kvec_t(ecstack1_t) stack; ++ ecseq_t seq, tmp, ec[2]; ++ int mode; ++ ecstat_t ori_st; ++} bfc_ec1buf_t; ++ ++/******************** ++ * Error correction * ++ ********************/ ++ ++typedef struct { ++ const bfc_opt_t *opt; ++ const bfc_ch_t *ch; ++ bfc_ec1buf_t **e; ++ int64_t n_processed; ++ int n_seqs, flt_uniq; ++ fml_seq1_t *seqs; ++} ec_step_t; ++ ++void kmer_correct(ec_step_t * es, int mode, bfc_ch_t * ch); ++void bfc_opt_init(bfc_opt_t *opt); ++ ++#endif diff --git a/patches/ensure-signed-comparison.patch b/patches/ensure-signed-comparison.patch new file mode 100644 index 0000000..3e3384c --- /dev/null +++ b/patches/ensure-signed-comparison.patch @@ -0,0 +1,22 @@ +Description: Ensure that our variable checking for >= 0 is signed + The type of v->n is size_t, which is an unsigned type, and we are assigning + v->n - 1 to i and looping while this is >= 0. If v->n == 0, on some + architectures (armhf) this results in i being set to a positive value + (specifically, UINT32_MAX). +Author: Steve Langasek +Last-Update: 2020-03-17 +Bug-Debian: https://bugs.debian.org/954127 + +Index: fermi-lite-0.1/mag.c +=================================================================== +--- fermi-lite-0.1.orig/mag.c ++++ fermi-lite-0.1/mag.c +@@ -506,7 +506,7 @@ + + for (j = 0; j < 2; ++j) { + sum_n = sum_l = 0; +- for (i = v->n - 1; i >= 0; --i) { ++ for (i = (int64_t)v->n - 1; i >= 0; --i) { + const magv_t *p = &v->a[srt[i]<<32>>32]; + int tmp1, tmp2; + tmp1 = tmp2 = 0; diff --git a/patches/gcc10.patch b/patches/gcc10.patch new file mode 100644 index 0000000..3e7f65f --- /dev/null +++ b/patches/gcc10.patch @@ -0,0 +1,16 @@ +Description: Fix package to build with GCC-10 +Bug-Debian: https://bugs.debian.org/957198 +Author: Nilesh Patra +Last-Update: Sat, 18 Apr 2020 22:55:21 +0530 + +--- a/rle.h ++++ b/rle.h +@@ -30,7 +30,7 @@ + *** 43+3 codec *** + ******************/ + +-const uint8_t rle_auxtab[8]; ++extern const uint8_t rle_auxtab[8]; + + #define RLE_MIN_SPACE 18 + #define rle_nptr(block) ((uint16_t*)(block)) diff --git a/patches/hardening b/patches/hardening new file mode 100644 index 0000000..e416fe1 --- /dev/null +++ b/patches/hardening @@ -0,0 +1,43 @@ +Description: add hardening flags + Adds necessary build flags for hardening. +Author: Sascha Steinbiss +Last-Update: 2016-01-08 +--- fermi-lite.orig/Makefile ++++ fermi-lite/Makefile +@@ -1,30 +1,27 @@ +-CC= gcc +-CFLAGS= -g -Wall -O2 -fPIC #-fno-inline-functions -fno-inline-functions-called-once +-CPPFLAGS= ++CC?= gcc ++CFLAGS+= -g -Wall -O2 -fPIC #-fno-inline-functions -fno-inline-functions-called-once ++#CPPFLAGS= + INCLUDES= + OBJS= kthread.o misc.o \ + bseq.o htab.o bfc.o \ + rle.o rope.o mrope.o rld0.o \ + unitig.o mag.o bubble.o ksw.o + PROG= fml-asm +-LIBS= -lm -lz -lpthread ++LDLIBS+= -lm -lz -lpthread + SONUMBER=0 + + .SUFFIXES:.c .o + +-.c.o: +- $(CC) -c $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $< -o $@ +- + all:$(PROG) libfml.so.$(SONUMBER) + + fml-asm:libfml.a example.o +- $(CC) $(CFLAGS) $^ -o $@ -L. -lfml $(LIBS) ++ $(CC) $(LDFLAGS) $(CFLAGS) $^ -o $@ -L. -lfml $(LDLIBS) + + libfml.a:$(OBJS) + $(AR) -csru $@ $(OBJS) + + libfml.so.$(SONUMBER): $(OBJS) +- $(CC) -shared -o $@ $(OBJS) -fPIC -Wl,-soname,libfml.so.$(SONUMBER) $(LIBS) $(LDFLAGS) ++ $(CC) $(LDFLAGS) -shared -o $@ $(OBJS) -fPIC -Wl,-soname,libfml.so.$(SONUMBER) $(LDLIBS) + + + clean: diff --git a/patches/make_shared_lib b/patches/make_shared_lib new file mode 100644 index 0000000..eec0747 --- /dev/null +++ b/patches/make_shared_lib @@ -0,0 +1,40 @@ +Description: build shared library + Upstream only builds a static library, this adds a shared one. +Author: Sascha Steinbiss +Last-Update: 2016-01-08 +--- a/Makefile ++++ b/Makefile +@@ -1,5 +1,5 @@ + CC= gcc +-CFLAGS= -g -Wall -O2 -Wno-unused-function #-fno-inline-functions -fno-inline-functions-called-once ++CFLAGS= -g -Wall -O2 -fPIC #-fno-inline-functions -fno-inline-functions-called-once + CPPFLAGS= + INCLUDES= + OBJS= kthread.o misc.o \ +@@ -8,13 +8,14 @@ + unitig.o mag.o bubble.o ksw.o + PROG= fml-asm + LIBS= -lm -lz -lpthread ++SONUMBER=0 + + .SUFFIXES:.c .o + + .c.o: + $(CC) -c $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $< -o $@ + +-all:$(PROG) ++all:$(PROG) libfml.so.$(SONUMBER) + + fml-asm:libfml.a example.o + $(CC) $(CFLAGS) $^ -o $@ -L. -lfml $(LIBS) +@@ -22,6 +23,10 @@ + libfml.a:$(OBJS) + $(AR) -csru $@ $(OBJS) + ++libfml.so.$(SONUMBER): $(OBJS) ++ $(CC) -shared -o $@ $(OBJS) -fPIC -Wl,-soname,libfml.so.$(SONUMBER) $(LIBS) $(LDFLAGS) ++ ++ + clean: + rm -fr gmon.out *.o ext/*.o a.out $(PROG) *~ *.a *.dSYM session* + diff --git a/patches/rename_bseq1_t.patch b/patches/rename_bseq1_t.patch new file mode 100644 index 0000000..412eb33 --- /dev/null +++ b/patches/rename_bseq1_t.patch @@ -0,0 +1,260 @@ +Description: Avoid name space conflict with bwa +Bug-Upstream: https://github.com/lh3/fermi-lite/issues/5 +Author: Andreas Tille +Last-Update: Thu, 02 Feb 2017 10:57:56 +0100 + +--- a/bfc.c ++++ b/bfc.c +@@ -60,7 +60,7 @@ typedef struct { // cache to reduce lock + typedef struct { + int k, q; + int n_seqs; +- const bseq1_t *seqs; ++ const fml_seq1_t *seqs; + bfc_ch_t *ch; + int *n_buf; + insbuf_t **buf; +@@ -97,7 +97,7 @@ static void bfc_kmer_insert(cnt_step_t * + static void worker_count(void *_data, long k, int tid) + { + cnt_step_t *cs = (cnt_step_t*)_data; +- const bseq1_t *s = &cs->seqs[k]; ++ const fml_seq1_t *s = &cs->seqs[k]; + int i, l; + bfc_kmer_t x = bfc_kmer_null; + uint64_t qmer = 0, mask = (1ULL<k) - 1; +@@ -111,7 +111,7 @@ static void worker_count(void *_data, lo + } + } + +-struct bfc_ch_s *fml_count(int n, const bseq1_t *seq, int k, int q, int l_pre, int n_threads) ++struct bfc_ch_s *fml_count(int n, const fml_seq1_t *seq, int k, int q, int l_pre, int n_threads) + { + int i; + cnt_step_t cs; +@@ -577,10 +577,10 @@ typedef struct { + bfc_ec1buf_t **e; + int64_t n_processed; + int n_seqs, flt_uniq; +- bseq1_t *seqs; ++ fml_seq1_t *seqs; + } ec_step_t; + +-static uint64_t max_streak(int k, const bfc_ch_t *ch, const bseq1_t *s) ++static uint64_t max_streak(int k, const bfc_ch_t *ch, const fml_seq1_t *s) + { + int i, l; + uint64_t max = 0, t = 0; +@@ -602,7 +602,7 @@ static uint64_t max_streak(int k, const + static void worker_ec(void *_data, long k, int tid) + { + ec_step_t *es = (ec_step_t*)_data; +- bseq1_t *s = &es->seqs[k]; ++ fml_seq1_t *s = &es->seqs[k]; + if (es->flt_uniq) { + uint64_t max; + max = max_streak(es->opt->k, es->ch, s); +@@ -624,7 +624,7 @@ static void worker_ec(void *_data, long + } else bfc_ec1(es->e[tid], s->seq, s->qual); + } + +-float fml_correct_core(const fml_opt_t *opt, int flt_uniq, int n, bseq1_t *seq) ++float fml_correct_core(const fml_opt_t *opt, int flt_uniq, int n, fml_seq1_t *seq) + { + bfc_ch_t *ch; + int i, mode; +@@ -663,12 +663,12 @@ float fml_correct_core(const fml_opt_t * + return kcov; + } + +-float fml_correct(const fml_opt_t *opt, int n, bseq1_t *seq) ++float fml_correct(const fml_opt_t *opt, int n, fml_seq1_t *seq) + { + return fml_correct_core(opt, 0, n, seq); + } + +-float fml_fltuniq(const fml_opt_t *opt, int n, bseq1_t *seq) ++float fml_fltuniq(const fml_opt_t *opt, int n, fml_seq1_t *seq) + { + return fml_correct_core(opt, 1, n, seq); + } +--- a/bseq.c ++++ b/bseq.c +@@ -6,10 +6,10 @@ + #include "kseq.h" + KSEQ_INIT(gzFile, gzread) + +-bseq1_t *bseq_read(const char *fn, int *n_) ++fml_seq1_t *fml_seq_read(const char *fn, int *n_) + { + gzFile fp; +- bseq1_t *seqs; ++ fml_seq1_t *seqs; + kseq_t *ks; + int m, n; + uint64_t size = 0; +@@ -21,10 +21,10 @@ bseq1_t *bseq_read(const char *fn, int * + + m = n = 0; seqs = 0; + while (kseq_read(ks) >= 0) { +- bseq1_t *s; ++ fml_seq1_t *s; + if (n >= m) { + m = m? m<<1 : 256; +- seqs = realloc(seqs, m * sizeof(bseq1_t)); ++ seqs = realloc(seqs, m * sizeof(fml_seq1_t)); + } + s = &seqs[n]; + s->seq = strdup(ks->seq.s); +--- a/misc.c ++++ b/misc.c +@@ -40,7 +40,7 @@ void fml_opt_init(fml_opt_t *opt) + opt->mag_opt.flag = MAG_F_NO_SIMPL | MAG_F_POPOPEN; + } + +-void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const bseq1_t *seqs) ++void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const fml_seq1_t *seqs) + { + int i, log_len; + uint64_t tot_len = 0; +@@ -62,7 +62,7 @@ static inline int is_rev_same(int l, con + return (i == l>>1); + } + +-struct rld_t *fml_fmi_gen(int n, bseq1_t *seq, int is_mt) ++struct rld_t *fml_fmi_gen(int n, fml_seq1_t *seq, int is_mt) + { + mrope_t *mr; + kstring_t str = {0,0,0}; +@@ -80,7 +80,7 @@ struct rld_t *fml_fmi_gen(int n, bseq1_t + mr = mr_init(ROPE_DEF_MAX_NODES, ROPE_DEF_BLOCK_LEN, MR_SO_RCLO); + for (k = 0; k < n; ++k) { + int i; +- bseq1_t *s = &seq[k]; ++ fml_seq1_t *s = &seq[k]; + if (s->l_seq == 0) continue; + free(s->qual); + for (i = 0; i < s->l_seq; ++i) +@@ -121,7 +121,7 @@ struct rld_t *fml_fmi_gen(int n, bseq1_t + return e; + } + +-struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, bseq1_t *seq) ++struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, fml_seq1_t *seq) + { + return fml_fmi_gen(n, seq, opt->n_threads > 1? 1 : 0); + } +@@ -277,7 +277,7 @@ void fml_utg_destroy(int n, fml_utg_t *u + + #define MAG_MIN_NSR_COEF .1 + +-fml_utg_t *fml_assemble(const fml_opt_t *opt0, int n_seqs, bseq1_t *seqs, int *n_utg) ++fml_utg_t *fml_assemble(const fml_opt_t *opt0, int n_seqs, fml_seq1_t *seqs, int *n_utg) + { + rld_t *e; + mag_t *g; +--- a/example.c ++++ b/example.c +@@ -7,7 +7,7 @@ int main(int argc, char *argv[]) + { + fml_opt_t opt; + int c, n_seqs, n_utg, gfa_out = 0; +- bseq1_t *seqs; ++ fml_seq1_t *seqs; + fml_utg_t *utg; + + fml_opt_init(&opt); +@@ -41,7 +41,7 @@ int main(int argc, char *argv[]) + fprintf(stderr, " -g output the assembly graph in the GFA format\n"); + return 1; + } +- seqs = bseq_read(argv[optind], &n_seqs); ++ seqs = fml_seq_read(argv[optind], &n_seqs); + utg = fml_assemble(&opt, n_seqs, seqs, &n_utg); + if (!gfa_out) fml_utg_print(n_utg, utg); + else fml_utg_print_gfa(n_utg, utg); +--- a/internal.h ++++ b/internal.h +@@ -12,7 +12,7 @@ extern "C" { + void kt_for(int n_threads, void (*func)(void*,long,int), void *data, long n); + void seq_reverse(int l, unsigned char *s); + void seq_revcomp6(int l, unsigned char *s); +-struct bfc_ch_s *fml_count(int n, const bseq1_t *seq, int k, int q, int l_pre, int n_threads); ++struct bfc_ch_s *fml_count(int n, const fml_seq1_t *seq, int k, int q, int l_pre, int n_threads); + + #ifdef __cplusplus + } +--- a/fml.h ++++ b/fml.h +@@ -8,7 +8,7 @@ + typedef struct { + int32_t l_seq; + char *seq, *qual; // NULL-terminated strings; length expected to match $l_seq +-} bseq1_t; ++} fml_seq1_t; + + #define MAG_F_AGGRESSIVE 0x20 // pop variant bubbles (not default) + #define MAG_F_POPOPEN 0x40 // aggressive tip trimming (default) +@@ -63,7 +63,7 @@ extern "C" { + * + * @return array of sequences + */ +-bseq1_t *bseq_read(const char *fn, int *n); ++fml_seq1_t *fml_seq_read(const char *fn, int *n); + + /** + * Initialize default parameters +@@ -82,7 +82,7 @@ void fml_opt_init(fml_opt_t *opt); + * + * @return array of unitigs + */ +-fml_utg_t *fml_assemble(const fml_opt_t *opt, int n_seqs, bseq1_t *seqs, int *n_utg); ++fml_utg_t *fml_assemble(const fml_opt_t *opt, int n_seqs, fml_seq1_t *seqs, int *n_utg); + + /** + * Free unitigs +@@ -103,7 +103,7 @@ void fml_utg_destroy(int n_utg, fml_utg_ + * @param n_seqs number of sequences + * @param seqs array of sequences + */ +-void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const bseq1_t *seqs); ++void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const fml_seq1_t *seqs); + + /** + * Error correction +@@ -114,8 +114,8 @@ void fml_opt_adjust(fml_opt_t *opt, int + * + * @return k-mer coverage + */ +-float fml_correct(const fml_opt_t *opt, int n, bseq1_t *seq); +-float fml_fltuniq(const fml_opt_t *opt, int n, bseq1_t *seq); ++float fml_correct(const fml_opt_t *opt, int n, fml_seq1_t *seq); ++float fml_fltuniq(const fml_opt_t *opt, int n, fml_seq1_t *seq); + + /** + * Construct FMD-index +@@ -126,7 +126,7 @@ float fml_fltuniq(const fml_opt_t *opt, + * + * @return FMD-index on success; NULL if all input sequences are zero in length + */ +-struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, bseq1_t *seq); ++struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, fml_seq1_t *seq); + + /** + * Generate initial overlap graph +--- a/README.md ++++ b/README.md +@@ -34,11 +34,11 @@ sketch of the example: + int main(int argc, char *argv[]) + { + int i, n_seqs, n_utgs; +- bseq1_t *seqs; // array of input sequences ++ fml_seq1_t *seqs; // array of input sequences + fml_utg_t *utgs; // array of output unitigs + fml_opt_t opt; + if (argc == 1) return 1; // do nothing if there is no input file +- seqs = bseq_read(argv[1], &n_seqs); // or fill the array with callers' functions ++ seqs = fml_seq_read(argv[1], &n_seqs); // or fill the array with callers' functions + fml_opt_init(&opt); // initialize parameters + utgs = fml_assemble(&opt, n_seqs, seqs, &n_utgs); // assemble! + for (i = 0; i < n_utgs; ++i) // output in fasta diff --git a/patches/series b/patches/series new file mode 100644 index 0000000..54b3bdd --- /dev/null +++ b/patches/series @@ -0,0 +1,8 @@ +make_shared_lib +hardening +rename_bseq1_t.patch +bcf_seqlib.patch +simde +ensure-signed-comparison.patch +sync_instead_of_atomic +gcc10.patch diff --git a/patches/simde b/patches/simde new file mode 100644 index 0000000..869771e --- /dev/null +++ b/patches/simde @@ -0,0 +1,14 @@ +Author: Michael R. Crusoe +Description: use the simde header library for greater compatibility +--- fermi-lite.orig/ksw.c ++++ fermi-lite/ksw.c +@@ -25,7 +25,8 @@ + + #include + #include +-#include ++#define SIMDE_ENABLE_NATIVE_ALIASES ++#include + #include "ksw.h" + + #ifdef __GNUC__ diff --git a/patches/sync_instead_of_atomic b/patches/sync_instead_of_atomic new file mode 100644 index 0000000..ef57148 --- /dev/null +++ b/patches/sync_instead_of_atomic @@ -0,0 +1,23 @@ +From: Michael R. Crusoe +Subject: fix compatibility on mipsel +Forwarded: https://github.com/lh3/fermi-lite/pull/13 +--- fermi-lite.orig/unitig.c ++++ fermi-lite/unitig.c +@@ -71,7 +71,7 @@ + { + uint64_t *p = bits + (x>>6); + uint64_t z = 1LLU<<(x&0x3f); +- __sync_fetch_and_or(p, z); ++ __atomic_fetch_or(p, z, __ATOMIC_SEQ_CST); + } + + static inline void set_bits(uint64_t *bits, const rldintv_t *p) +@@ -389,7 +389,7 @@ + magv_t *q; + p[0] = w->visited + (d->z.k[0]>>6); x[0] = 1LLU<<(d->z.k[0]&0x3f); + p[1] = w->visited + (d->z.k[1]>>6); x[1] = 1LLU<<(d->z.k[1]&0x3f); +- if ((__sync_fetch_and_or(p[0], x[0])&x[0]) || (__sync_fetch_and_or(p[1], x[1])&x[1])) return; ++ if ((__atomic_fetch_or(p[0], x[0], __ATOMIC_SEQ_CST)&x[0]) || (__atomic_fetch_or(p[1], x[1], __ATOMIC_SEQ_CST)&x[1])) return; + d->z.len = d->str.l; + if (d->max_l < d->str.m) { + d->max_l = d->str.m; diff --git a/rules b/rules new file mode 100755 index 0000000..30bbcd8 --- /dev/null +++ b/rules @@ -0,0 +1,43 @@ +#!/usr/bin/make -f + +include /usr/share/dpkg/default.mk +export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow +export DEB_CFLAGS_MAINT_APPEND += -DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3 +export DEB_CXXFLAGS_MAINT_APPEND += -DSIMDE_ENABLE_OPENMP -fopenmp-simd -O3 +ifneq (,$(filter $(DEB_HOST_ARCH), armel m68k mipsel powerpc sh4)) + export LDLIBS=-latomic +endif + +%: + dh $@ + +override_dh_auto_clean: + dh_auto_clean + rm -f fml-asm.1 + +override_dh_auto_install: + ln -s libfml.so.* libfml.so + d-shlibmove --commit \ + --multiarch \ + --devunversioned \ + --movedev "fml.h" /usr/include/ \ + --movedev "bfc.h" /usr/include/fml \ + --movedev "htab.h" /usr/include/fml \ + --movedev "kmer.h" /usr/include/fml \ + --movedev "internal.h" /usr/include/fml \ + --movedev "khash.h" /usr/include/fml \ + --movedev "kvec.h" /usr/include/fml \ + --movedev "ksort.h" /usr/include/fml \ + libfml.so + +override_dh_installman: + help2man --version-string='0.1' \ + -n 'assemble Illumina short reads in small regions' \ + -N --no-discard-stderr -h '' ./fml-asm > fml-asm.1 + dh_installman + +override_dh_auto_test: +ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) + ./fml-asm test/MT-simu.fq.gz > MT.fq + test "$$(wc -l < MT.fq)" = "4" +endif diff --git a/salsa-ci.yml b/salsa-ci.yml new file mode 100644 index 0000000..33c3a64 --- /dev/null +++ b/salsa-ci.yml @@ -0,0 +1,4 @@ +--- +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff --git a/source/format b/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/tests/asm b/tests/asm new file mode 100755 index 0000000..c3a8048 --- /dev/null +++ b/tests/asm @@ -0,0 +1,8 @@ +#!/bin/sh +# autopkgtest check: confirm that fml-asm works +set -e + +INPUT=$(pwd)/test/MT-simu.fq.gz + +test "$(fml-asm ${INPUT} | wc -l)" = "4" +echo "run: OK" diff --git a/tests/build-lib b/tests/build-lib new file mode 100755 index 0000000..2fa3f3c --- /dev/null +++ b/tests/build-lib @@ -0,0 +1,19 @@ +#!/bin/sh +# autopkgtest check: Build and run a program against libfml +# Author: Sascha Steinbiss +set -e + +SRC=$(pwd)/example.c +DATADIR=$(pwd)/test +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR + +cp $SRC . +gcc -O2 -o fermi-lite example.c -lfml -lz -lm -lpthread +[ -x fermi-lite ] +echo "build: OK" + +./fermi-lite $DATADIR/MT-simu.fq.gz > out +ldd fermi-lite +echo "run: OK" diff --git a/tests/control b/tests/control new file mode 100644 index 0000000..55f863a --- /dev/null +++ b/tests/control @@ -0,0 +1,7 @@ +Tests: build-lib +Depends: @, build-essential +Restrictions: allow-stderr + +Tests: asm +Depends: fml-asm +Restrictions: allow-stderr diff --git a/upstream/metadata b/upstream/metadata new file mode 100644 index 0000000..29103a4 --- /dev/null +++ b/upstream/metadata @@ -0,0 +1,13 @@ +Bug-Database: https://github.com/lh3/fermi-lite/issues +Bug-Submit: https://github.com/lh3/fermi-lite/issues/new +Registry: + - Name: OMICtools + Entry: OMICS_01087 + - Name: bio.tools + Entry: flexbar + - Name: SciCrunch + Entry: SCR_013001 + - Name: conda:bioconda + Entry: fermi-lite +Repository: https://github.com/lh3/fermi-lite.git +Repository-Browse: https://github.com/lh3/fermi-lite diff --git a/watch b/watch new file mode 100644 index 0000000..d97a11c --- /dev/null +++ b/watch @@ -0,0 +1,7 @@ +version=4 + +opts="mode=git,pretty=0.1+git%cd.%h" \ + https://github.com/lh3/fermi-lite.git HEAD + +#https://github.com/lh3/fermi-lite/releases .*/archive/v(\d[\d.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz) + -- 2.30.2